1. Field of the Invention
This invention relates to a database system, and particularly relates to a database system characterized by its exclusive control method.
2. Description of the Prior Art
A conventional database system is described first. When a database processing program of a database requests input or output to a certain block in the database for the purpose of reference or update, a block exclusive control device in the system judges whether the requested block is already in use or not. If the block is in use, the block exclusive control device judges the mode and decides whether to accept the request or to have it wait, depending on the mode.
If the requested block is not in use, the request from the database processing program is accepted, a database input/output device reads the applicable block from the database and stores it in the buffer assigned to that database processing program. In case the applicable block already exists on the buffer, however, the block is not read from the database. Then, the database processing program refers to or updates the data in the block on the buffer via a database processing device.
If the database processing program requires more capacity than the buffer has for reference to or update of blocks from the database, some of the blocks are selected from the buffer for a certain reason (low access frequency, for example) and emptied so that they can be used again. In this case, already updated blocks are rewritten to the database.
On the other hand, before a database processing program requests establishment of a processing request execution point, another database processing program may send an input request for reference or input/output request for update to the same block on the database. Such a request is accepted if both database processing programs are in a reference exclusive mode. However, if either of them is in an update exclusive mode, the latter database processing program is placed in the wait state. The same thing happens even for the mode allowing reference during update processing or update during reference processing.
Since a database processing program refers to or updates a block from the database on a buffer, another database processing program may read the same block from the database at the same time for update or reference. The latter program can only refer to or update the contents as of the time it reads the block, but this causes no problem if either of the programs reads the block just for reference. However, overflow at the buffer may involve rereading of or rewriting to the same block in the database, which can cause the block to have contents different from the one read before, resulting in contradiction. To prevent such an event, it is necessary to reject the request which comes later if it is in update mode and put the program in wait state. Thus, the database processing program enters the wait stats when its request is not accepted, and the request is accepted when the preceding database processing program terminates the use of the applicable block with establishment of a processing request execution point. Processing after that is the same as described above.
Both database processing programs request establishment of a processing request execution point when their processing comes to an end, with rewriting the updated blocks on the buffer to the database and releasing the applicable block. In the event of deadlock, contents of the block to be stored on the buffer are discarded and the database is returned to the state as of the previous processing request execution point.
As described above, with a conventional database system, a database processing program trying to refer to the block already in use for update by another database processing program or trying to update the same block as the one already referred to by another database processing program is placed in the wait state until the establishment of a processing request execution point by the preceding database processing program. This impedes improvement of database processing efficiency.